<%@ page language="java" import="dao.*" pageEncoding="UTF-8" %>
 <%@ page language="java" import="java.util.*" %>
 <%@page import="util.*" %>
 <%  %>
 <% Map map = Query.make("cheliang").where("id", request.getParameter("id")).find(); %>
<%@ include file="head.jsp" %>
 <%@ include file="header.jsp" %>

<link rel="stylesheet" href="js/swiper/swiper.css" />
<script src="js/swiper/swiper.js"></script>
<script src="js/jquery.validate.js"></script>
<script src="js/datepicker/WdatePicker.js"></script>

<div>
    <div class="container">
        <!-- 使用bootstrap css框架，container定宽，并剧中 https://v3.bootcss.com/css/#overview-container -->

        <div class="title-sn-title" style="margin: 15px 0 15px 0; padding: 10px">
            <div class="sn-title" :style="style">

                <span> 详情 </span>
            </div>
            <div class="sn-content">
                <div class="">
                    <div class="goods-info clearfix">
                        <div class="gallery-list">
                            <div class="swiper-container gallery-top" id="shangpin-galler">
                                <div class="swiper-wrapper"></div>
                            </div>
                            <div class="swiper-container gallery-thumbs" id="shangpin-thumb">
                                <div class="swiper-wrapper"></div>
                            </div>
                        </div>
                        <div class="goods-right-content">
                            <h3 class="title"><%= map.get("biaoti") %></h3>
                            <div class="descount">
                                <div>
                                    <span class="name"> 编号： </span>
                                    <span class="val"> <%= map.get("bianhao") %> </span>
                                </div>
                                <div>
                                    <span class="name"> 分类： </span>
                                    <span class="val"> <% Map mapfenlei11 = new CommDAO().find("SELECT fenleiming FROM fenlei where id='" + map.get("fenlei") + "'"); %>
<%= mapfenlei11.get("fenleiming") %> </span>
                                </div>
                                <div>
                                    <span class="name"> 品牌： </span>
                                    <span class="val"> <% Map mappinpai12 = new CommDAO().find("SELECT pinpaiming FROM pinpai where id='" + map.get("pinpai") + "'"); %>
<%= mappinpai12.get("pinpaiming") %> </span>
                                </div>
                                <div>
                                    <span class="name"> 车型： </span>
                                    <span class="val"> <%= map.get("chexing") %> </span>
                                </div>
                                <div>
                                    <span class="name"> 公里数： </span>
                                    <span class="val"> <%= map.get("gonglishu") %> </span>
                                </div>
                                <div>
                                    <span class="name"> 报价： </span>
                                    <span class="val"> <%= map.get("baojia") %> </span>
                                </div>
                                <div>
                                    <span class="name"> 状态： </span>
                                    <span class="val"> <%= map.get("zhuangtai") %> </span>
                                </div>
                                <div>
                                    <span class="name"> 联系人： </span>
                                    <span class="val"> <%= map.get("lianxiren") %> </span>
                                </div>
                                <div>
                                    <span class="name"> 联系方式： </span>
                                    <span class="val"> <%= map.get("lianxifangshi") %> </span>
                                </div>
                            </div>

                            <% Map readMap = Query.make("cheliang").where("id", request.getParameter("id")).find(); %>

                            <form class="form-inline" action="yuyue.jsp?a=insert" id="form1" method="post">
                                <!-- form 标签开始 -->

                                <div style="display: none">
                                    <input type="hidden" name="cheliangid" value="<%= request.getParameter("id") !=null ? request.getParameter("id") : "" %>" /> <input type="hidden" id="bianhao" name="bianhao" value="<%= Info.html(map.get("bianhao")) %>" />
                                    <input type="hidden" id="biaoti" name="biaoti" value="<%= Info.html(map.get("biaoti")) %>" />
                                    <input type="hidden" id="tupian" name="tupian" value="<%= Info.html(map.get("tupian")) %>" />
                                    <input type="hidden" id="fenlei" name="fenlei" value="<%= Info.html(map.get("fenlei")) %>" />
                                    <input type="hidden" id="pinpai" name="pinpai" value="<%= Info.html(map.get("pinpai")) %>" />
                                    <input type="hidden" id="chexing" name="chexing" value="<%= Info.html(map.get("chexing")) %>" />
                                    <input type="hidden" id="tianjiaren" name="tianjiaren" value="<%= Info.html(map.get("tianjiaren")) %>" />
                                    <input
                                        type="text"
                                        class="form-control"
                                        placeholder="输入预约人"
                                        style="width: 150px"
                                        readonly="readonly"
                                        id="yuyueren"
                                        name="yuyueren"
                                        value="<%= request.getSession().getAttribute("username") !=null ? request.getSession().getAttribute("username") : "" %>"
                                    />
                                    <input name="referer" id="referer" value="" type="hidden" />
                                    <script>
                                        $("#referer").val(location.href);
                                    </script>
                                    <input type="hidden" name="zhuangtai" id="zhuangtai" value="待确认" />
                                </div>

                                <div class="mt10">
                                    <div class="spec-list"></div>
                                    <div class="mt10">
                                    <% if (request.getSession().getAttribute("username") == null || "".equals(request.getSession().getAttribute("username"))) { %>

                                    <button type="button" class="btn btn-primary" onclick="alert('你尚未登录，请登录后操作')">
                                        询价
                                    </button>
                                    <%} else { %>
                                    <a href="xunjiaadd.jsp?id=<%= map.get("id") %>" type="submit" class="btn btn-primary">询价</a>

                                    <%} %>

                                    <% if (request.getSession().getAttribute("username") == null || "".equals(request.getSession().getAttribute("username"))) { %>

                                    <button type="button" class="btn btn-primary" onclick="alert('你尚未登录，请登录后操作')">
                                        预约
                                    </button>
                                    <%} else { %>
                                    <a href="yuyueadd.jsp?id=<%= map.get("id") %>" type="submit" class="btn btn-primary">预约</a>
                                    <%} %>
                                    <% if (request.getSession().getAttribute("username") != null && !("".equals(request.getSession().getAttribute("username")))) { %>
                                    <%
                                        Map shoucangCount = Query
                                                .make("shoucang")
                                                .where("biao", "cheliang")
                                                .where("xwid", map.get("id"))
                                                .where("username", request.getSession().getAttribute("username"))
                                                .field("count(*) as count")
                                                .find();
                                    %>
                                    <% if (!(shoucangCount.get("count").equals("0"))) { %>

                                    <button
                                            type="button"
                                            class="btn btn-default"
                                            onclick="location.href='shoucang.jsp?a=insert&xwid=<%= map.get("id") %>&biao=cheliang&biaoti=<%= map.get("biaoti") %>'"
                                    >
                                        取消收藏
                                    </button>
                                    <%} else { %>
                                    <button
                                            type="button"
                                            class="btn btn-default"
                                            onclick="location.href='shoucang.jsp?a=insert&xwid=<%= map.get("id") %>&biao=cheliang&biaoti=<%= map.get("biaoti") %>'"
                                    >
                                        收藏
                                    </button>
                                    <%} %>
                                    <%} else { %>
                                    <button
                                            type="button"
                                            class="btn btn-default"
                                            onclick="location.href='shoucang.jsp?a=insert&xwid=<%= map.get("id") %>&biao=cheliang&biaoti=<%= map.get("biaoti") %>'"
                                    >
                                        收藏
                                    </button>
                                    <%} %>

                                </div>
                        </div>
                                <!--form标签结束-->
                            </form>
                            <script>
                                $(function () {
                                    $("#form1").validate();
                                });
                            </script>
                        </div>
                    </div>
                    <div class="goods-content"></div>

                    <script>
                        (function () {
                            var images = "<%= map.get("tupian") %>".split(",");
                            if (images.length > 0) {
                                for (var i = 0; i < images.length; i++) {
                                    var path = images[i];
                                    var src =
                                        '<div class="swiper-slide"><div class="img-box pb100"><div class="img" style="background-image: url(' + path + ')"></div></div></div>';
                                    $("#shangpin-galler .swiper-wrapper").append(src);
                                    $("#shangpin-thumb .swiper-wrapper").append(src);
                                }

                                var thumbsSwiper = new Swiper("#shangpin-thumb", {
                                    spaceBetween: 10,
                                    slidesPerView: 4,
                                    watchSlidesVisibility: true, //防止不可点击
                                });
                                var gallerySwiper = new Swiper("#shangpin-galler", {
                                    spaceBetween: 10,
                                    thumbs: {
                                        swiper: thumbsSwiper,
                                    },
                                });
                            }
                        })();
                    </script>
                </div>
            </div>
        </div>

        <!-- container定宽，并剧中结束 -->
    </div>
</div>
<div>
    <div class="container">
        <!-- 使用bootstrap css框架，container定宽，并剧中 https://v3.bootcss.com/css/#overview-container -->

        <div style="margin: 15px 0 15px 0; padding: 10px; text-indent: 1em"><%= map.get("xiangqing") %></div>

        <!-- container定宽，并剧中结束 -->
    </div>
</div>
<%@ include file="footer.jsp" %>
 <%@ include file="foot.jsp" %>

